import { Component, OnInit } from '@angular/core';
import { FlowInfoService } from './flow-info.service';

@Component({
  selector: 'app-flow-info',
  templateUrl: './flow-info.component.html',
  styleUrls: ['./flow-info.component.scss'],
  providers:[FlowInfoService]
})
export class FlowInfoComponent implements OnInit {
  // 传入的对象
  public item:any;

  // 单个数据的流程明细
  public singleFlowInfo: any =[] ;

  constructor(
    public flowInfoService:FlowInfoService
  ) { }

  ngOnInit() {
    this.GetSingleInfo();
    //判断如果批次号为空，则直接取原数据
    // if( this.item.nBatchNo == ''|| this.item.nBatchNo == null ){
    //   this.singleFlowInfo.push(this.item);
    // }else{
    //   this.GetSingleInfo();
    // }
    
  }
   // 查询单个数据的流程明细
   GetSingleInfo(){
    let that = this;
    let getBody: any = {
      nBatchNo: that.item.nBatchNo,
      nQjId: that.item.nQdId ? that.item.nQdId : that.item.nQjId
    }
      this.flowInfoService.detail(getBody).subscribe(data => {
      if (data) {
        this.singleFlowInfo = data.list;
        console.log(this.singleFlowInfo);
      }
    });
  }

}
